home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1199 / 1163 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  1.6 KB

  1. Date: Mon, 7 Mar 1994 18:39:33 -0500
  2. From: "Nicholas S Castellano" <entropy@terminator.rs.itd.umich.edu>
  3. To: nox@jelal.north.de
  4. In-Reply-To: Juergen Lock's message of Thu, 3 Mar 94 19:58:24 CET <9403031858.AA00174@jelal.north.de>
  5. Subject: another 1.10 job control bug?
  6.  
  7. A few days ago, you said:
  8.  
  9. >Date: Thu, 3 Mar 94 19:58:24 CET
  10. >From: Juergen Lock <nox@jelal.north.de>
  11.  
  12. >+#else
  13. >+/* release the controlling terminal, if we're the last member of this pgroup */
  14. >+    fp = curproc->handle[-1];
  15. >+    if (fp && is_terminal(fp)) {
  16. >+        struct tty *tty = (struct tty *)fp->devinfo;
  17. >+        int pgrp = curproc->pgrp;
  18. >+
  19. >+        if (pgrp == tty->pgrp) {
  20. >+            PROC *p;
  21. >+            int found = 0;
  22. >+
  23. >+            for (p = proclist; p; p = p->gl_next) {
  24. >+                if (p->pgrp == pgrp && p->handle[-1] == fp)
  25. >+                    found++;
  26. >+            }
  27. >+            if (!found)
  28. >+                tty->pgrp = 0;
  29. >+        }
  30. >+    }
  31. >+#endif
  32.  
  33. It turns out this is one big no-op.  At the time terminate() is
  34. called, the exiting process still exists in proclist.  So 'found' is
  35. always incremented at least once (when the exiting process whose
  36. controlling terminal we're looking for is encountered) and the code to
  37. set tty->pgrp = 0 is never reached.
  38.  
  39. This may be the cause of the problem someone else reported with using
  40. the modem ports under a patched mint.
  41.  
  42. Replacing the loop with:
  43.  
  44.             for (p = proclist; p; p = p->gl_next) {
  45.                 if (p->pgrp == pgrp && p->handle[-1] == fp
  46.                     && p != curproc)
  47.                     found++;
  48.             }
  49.  
  50. ...seems to do the right thing more often.
  51.  
  52. --
  53. entropy -- it's not just a good idea, it's the second law.
  54. Personal mail:      entropy@gnu.ai.mit.edu
  55. MiNT library mail:  entropy@terminator.rs.itd.umich.edu
  56. "what do you have against octal?" -jrb
  57.  
  58.